﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace VersionAttribute
{
    [VersionAttribute(10)]
    class Test
    {
        static void Main()
        {
            //VersionAttribute[] attributes = (VersionAttribute[])typeof(ClassWithVersion).GetCustomAttributes(typeof(VersionAttribute),false);
            //Console.WriteLine(attributes[0].Version);
            Type type = typeof(ClassWithVersion);
            Type attributeType = typeof(VersionAttribute);
            MethodInfo[] methods = type.GetMethods();
            foreach (MethodInfo method in methods)
            {
                VersionAttribute[] attributes = (VersionAttribute[])method.GetCustomAttributes(attributeType, false);
                foreach (VersionAttribute attribute in attributes)
                {
                    Console.WriteLine(attribute.Version);
                }
            }
        }
    }
}
